home *** CD-ROM | disk | FTP | other *** search
- page ,132
-
- .xlist
- include mintdefs.asm
-
- data segment byte public
- mouse_flag db ?
- extrn scan_lines_per_char: byte
- data ends
-
- code segment byte public
-
- assume cs:code, ds: data, es: data
-
- public pick_init, pick_on, pick_off, check_pick, get_pick_values
- pick_init:
- call mouse_exists
- mov ax,0
- int 33h
- mov mouse_flag,al ;remember if the mouse exists.
- mov ax,4 ;move the mouse to the upper right hand.
- mov cx,635
- mov dx,0
- int 33h
- mov ax,10 ;set text cursor (ignored on Z-100).
- mov bx,0 ;software text cursor.
- mov cx,77ffh ;screen mask
- mov dx,7700h ;cursor mask
- int 33h
- call check_pick ;ensure that there are no up or down
- call check_pick ; events left.
- call check_pick
- call check_pick
- ret
-
-
- pick_on:
- call mouse_exists
- mov ax,1
- int 33h
- ret
-
-
- pick_off:
- call mouse_exists
- mov ax,1 ;ensure that we work with MOUSEKEY.
- int 33h
- mov ax,2
- int 33h
- ret
-
-
- check_pick:
- ;return nz and al=pick character. return zr if no pick.
- call mouse_exists
- push bx
- push cx
- push dx
- cmp mouse_flag,0 ;inhibit mouse presses if it isn't there.
- je check_pick_1
- mov ax,5
- mov bx,0 ;left button press
- int 33h
- mov ax,0feh
- or bx,bx
- jne check_pick_1
- mov ax,5 ;right button press
- mov bx,1
- int 33h
- mov ax,0fdh
- or bx,bx
- jne check_pick_1
- mov ax,5 ;middle button press
- mov bx,2
- int 33h
- mov ax,0fah
- or bx,bx
- jne check_pick_1
- mov ax,6 ;left button release
- mov bx,0
- int 33h
- mov ax,0fch
- or bx,bx
- jne check_pick_1
- mov ax,6 ;right button release
- mov bx,1
- int 33h
- mov ax,0fbh
- or bx,bx
- jne check_pick_1
- mov ax,6 ;middle button release
- mov bx,2
- int 33h
- mov ax,0f9h
- or bx,bx
- jne check_pick_1
- check_pick_1:
- pop dx
- pop cx
- pop bx
- ret
-
- get_pick_values:
- mov cx,0
- mov dx,0
- call mouse_exists
- mov ax,3
- int 33h
-
- push cx ;save the x value.
-
- mov ax,dx
- div scan_lines_per_char
- mov ah,0
- push ax
- call read_linesbefore
- push ax
- call read_newrow
- pop bx
- sub bx,ax ;bx=linesbefore - newrow.
- pop dx
- add dx,bx ;add y-value.
- inc dx ;ax= y-value - newrow + linesbefore + 1.
- pop ax ;compute the x-value.
-
- push dx
-
- mov cl,8
- div cl
- mov ah,0
- inc ax
- push ax ;add in firstcolumn.
- call read_firstcolumn
- pop cx
- add cx,ax
-
- pop dx
-
- ret
-
- extrn read_firstcolumn: near
- extrn read_linesbefore: near
- extrn read_newrow: near
-
-
- ;this routine returns from the routine that called it if the mouse is not
- ; installed.
- mouse_exists:
- push ds
- xor ax,ax
- mov ds,ax
- mov ax,word ptr ds:[33h*4+2]
- pop ds
- cmp ax,0 ;any mouse interrupt at all?
- je mouse_exists_2 ;no - no mouse.
- cmp ax,40h ;is the mouse interrupt in the bios?
- jne mouse_exists_1 ;no - must be a real mouse.
- mouse_exists_2:
- add sp,2
- xor ax,ax
- ret
- mouse_exists_1:
- ret
-
- code ends
-
- end
-